'use strict'
module.exports = app =>{
    const { STRING, INTEGER, DATE } = app.Sequelize;

    const User = app.model.define('user', {
        id: { type: INTEGER, primaryKey: true, autoIncrement: true },
        account: STRING(64),
        password:STRING(50),
        last_login_time:DATE,
        last_login_ip:STRING(40),
        email:STRING(50),
        remark:STRING(255),
        created_at: DATE,
        updated_at: DATE,
        status:INTEGER,
        uid:INTEGER
    },{
        freezeTableName: true
    });
    User.associate = function(){
        app.model.User.hasMany(app.model.Role,{foreignKey: 'userid', targetKey: 'uid'});
    };
    return User;
}